<template>
  <view class="container">
    <u-navbar title="完善客户信息" title-size="36"></u-navbar>
    <view class="content">
      <view class="info-item">
        <view class="info-title"> 名称 </view>
        <input class="info-desc" placeholder="添加名称" type="text" v-model="form.userAlias" />
      </view>
    </view>

    <!-- <view class="content">
			<view class="info-item">
				<view class="info-title">
					备注
				</view>
				<input class="info-desc" placeholder="添加备注" type="text" v-model="form.userMobile" />
			</view>
		</view> -->

    <view class="content">
      <view class="info-item">
        <view class="info-title"> 电话 </view>
        <input class="info-desc" placeholder="添加点话" type="text" v-model="form.userMobile" />
      </view>
    </view>

    <view class="content">
      <view class="info-item">
        <view class="info-title"> 单位 </view>
        <input class="info-desc" placeholder="添加单位" type="text" v-model="form.userCompany" />
      </view>
    </view>
    <view class="content">
      <view class="info-item">
        <view class="info-title"> 位置 </view>
        <input class="info-desc" placeholder="添加位置" type="text" v-model="form.userLocation" />
      </view>
    </view>

    <view class="floor">
      <view @click="submit" class="submit-btn"> 保存 </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      have: true,
      imgStyle: {
        width: '12rem'
      },
      form: {
        id: '',
        userAlias: '',
        userMobile: '',
        userCompany: '',
        userLocation: ''
      },
      current: 0,
      scurrent: 0,
      tabsList: [
        {
          name: '抢单'
        },
        {
          name: '会话'
        }
      ],
      itemList: [
        {
          status: 1
        },
        {
          status: 2
        },
        {
          status: 3
        }
      ],
      itemList2: [],
      order_id: ''
    }
  },
  onLoad(res) {
    this.form.id = res.id
    this.$u
      .get('/app-api/trade/brokerage-user/get-customer?customerUserId=' + res.id)
      .then((res) => {
        this.form = res.data
      })
  },
  onShow() {
    // this.$nextTick(()=> {
    // });
    // /this.onOrderLoad(this.current, null, true);
  },
  methods: {
    back() {
      uni.switchTab({
        url: '/pages/ucenter/ucenter'
      })
    },
    tabsChange(index) {
      this.scurrent = index
    },
    transition(e) {
      let dx = e.detail.dx
      this.$refs.uTabs.setDx(dx)
    },
    animationfinish(e) {
      let current = e.detail.current
      this.scurrent = current
      this.current = current
      this.$refs.uTabs.setFinishCurrent(current)
      if (this.current != current) {
        this.onOrderLoad(current, null, true)
      }
    },

    initData(page, pageSize, status) {
      //let self = this;
      // self.$u.api.getOrderList({
      // 	limit: pageSize,
      // 	page: page,
      // 	status: status
      // }).then(res => {
      // 	self.onOrderLoad(self.current, res.list, false);
      // }).catch(res => {
      // 	self.onOrderLoad(self.current, null, false);
      // });
      //this.onOrderLoad(this.current, this.itemList, false);
    },

    onOrderCancel(item) {
      let self = this
      uni.dialog.confirm('温馨提示', '确定要取消订单吗？', () => {
        self.$u.api.setOrderCancel(item.id).then((res) => {
          self.$u.toast('取消成功')
          setTimeout(function () {
            self.onOrderLoad(self.current, null, true)
          }, 500)
        })
      })
    },
    submit() {
      this.$u.put('/app-api/trade/brokerage-user/update-customer', this.form).then((res) => {
        this.$u.toast('成功')
        setTimeout(() => {
          uni.navigateBack()
        }, 800)
      })
    },
    routeTo() {
      uni.navigateTo({
        url: '/goods/goods-details/goods-details'
      })
    }
  }
}
</script>

<style scoped>
@import url('../../style/btn.css');

page {
  height: 100%;
  background: #fff;
}

.view_box {
  display: flex;
  padding: 20rpx;
  align-items: center;
  background-color: #fff;
  border-bottom: #ededed solid 2rpx;
}

.view-info {
  flex: 1;
  margin-left: 10rpx;
  line-height: 55rpx;
}

.view-info-p {
  font-size: 26rpx;
  color: #999;
}

.view-tip {
  width: 90rpx;
  height: 90rpx;
  border-radius: 90rpx;
  color: #fff;
  font-size: 24rpx;
  line-height: 90rpx;
  text-align: center;
}

.tabs {
  display: flex;
  justify-content: space-around;
  background-color: #fff;
}

.item {
  border-bottom: #0f76bb solid 8rpx;
  color: #0f76bb;
}

.content_area {
  padding: 20rpx;
}

.content-cat {
  display: flex;
  justify-content: space-around;
}

.view_box2 {
  display: flex;
  justify-content: space-evenly;
  height: 90rpx;
  align-items: center;
  font-size: 26rpx;
  text-align: center;
}

.content {
  padding: 15rpx 20rpx;
}

.info-desc {
  padding: 25rpx;
  background-color: #f6f6f6;
  margin: 5rpx 0;
}

.floor {
  display: flex;
  justify-content: center;
  margin-top: 300rpx;
}
</style>
